<template>
    <div>
        <div>
            <Row>
                <AutoQuery ref="auto-query" :query="query" :page="page" :buttons="['search','search_all']"></AutoQuery>
            </Row>
        </div>
        <AutoTable :columns="table.columns" :data="abutmentList" :page="page"></AutoTable>
    </div>
    
</template>
<script>
import AutoQuery from "@/common/components/AutoQuery";
import PlateformServiceAbutment from "@/common/model/PlateformServiceAbutment"
import PlateformService from "@/common/model/PlateformService"
import Vue from 'vue';
import iviewArea from 'iview-area';
import Page from "@/common/model/Page";
import AutoTable from "@/common/components/AutoTable";
import UploadedList from "@/common/components/UploadedList";
import StepsEditor from "@/common/components/StepsEditor"
export default {
    data(){

        return{
            detail_modal:false,
            //formValidate: new PlateformServiceAbutment("search/plateforme_service_abutment",{}),
            page:new Page("plateformabutment/getall"),
            abutment:new PlateformServiceAbutment(),
            query: {
                number:{ type: "input",label: "编号", placeholder: "请输入查询编号"},
                service_number:{ type :"input",label: "服务类别编号", placeholder: "请输入服务类别编号"},
                title: { type: "input", label: "服务名称", placeholder: "请输入平台服务名称" },
                begin_time: { type: "date", label: "申请日期", placeholder: "选择开始时间" },
                end_time: { type: "date", placeholder: "选择截止时间", handleValue: value => { return value + 24*60*60*1000 } },
                check_status: { type: "select",label: "审核状态：",placeholder: "请选择要查询的状态", default: "-1",  options: [
                    { value: "-1",label:"全部" },
                    { value: "0",label: "已删除" },
                    { value: "1",label: "未审核"},
                    { value: "2",label: "审核通过"},
                    { value: "3",label: "审核未通过"}
                ] },
            },
            table: {
                columns: [
                    {
                        title: '序号', width: 65, align: 'center', render: (h, params) => {
                            return h('div', (this.page.current_page - 1) * this.page.page_size + params.index + 1);
                        }
                    },
                    {
                        title: '编号', render:(h, params) => {
                            return h('div', params.row.number);
                        }
                    },
                    {
                        title: '服务类别编号', render:(h, params) => {
                            return h('div', params.row.service_number);
                        }
                    },
                    {
                        title: '服务名称', render:(h, params) => {
                            return h('div', params.row.plateformservice.title);
                        }
                    },
                    {
                        title: '申请人', render:(h, params) => {
                            return h('div', params.row.member.username);
                        }
                    },
                    {
                        title: '申请企业', render:(h, params) => {
                            return h('div', params.row.member.enterprise_name);
                        }
                    },
                    {
                        title: '申请日期', width: 150, align: 'center', key: 'create_time', sortable: "custom", render: (h, params) => {
                            return h('div',params.row.formated_create_time);
                        }
                    },
                    { 
                        title:"审核状态", align:"center", width:120, render:(h,params) => {
                        return h('div',[
                            h('Button',{
                                props : { type:["info","warning","success","error"][params.row.status],size:'small' },
                                style : { marginRight: '5px' }
                            },["已删除","未审核","审核通过","审核未通过"][params.row.status])
                        ]);
                    }},
                    {
                        title: '操作', key: 'action', width: 120, align: 'center', render: (h, params) => {
                        return h('div', [
                                h('Button', {
                                    props: { type: 'primary', size: 'small' },
                                    on: { click: () => { this.handlecheck(params.row) } }
                                }, '查看详情')
                            ])
                        }
                    }
                ],
            }
        }
    },
    components: {
        AutoTable,UploadedList,StepsEditor, AutoQuery
    },
    computed:{
        abutmentList(){
            return PlateformServiceAbutment.parseList(this.page.list);
        }
    },
    methods:{
        handlecheck(name) {
            this.$router.push({ name: "plateformservice_check", query: { id: name.id } });
        }
    }
}
</script>